<?php

namespace app\api\validate;

use think\Validate;

class Family extends Validate
{
    protected $rule = [
        ['logo',            'require',                                 '请先上传家族logo'],
        ['name',            'require|length:1,16|unique:cluster',      '请先输入家族名称|名称长度为1-16|名称已存在'],
        ['description',     'require|length:1,255',                    '请先输入家族简介|简介长度为1-255'],
        ['longitude',       'require',                                 '未获取到当前经度'],
        ['latitude',        'require',                                 '未获取到当前纬度'],
        ['city',            'require',                                 '请先选择城市'],
        ['id',              'require|number|>:0',                      '请先选择家族|请先选择家族|请先选择家族'],
        ['reason',          'max:64',                                  '申请理由长度不能超过64字数'],
        ['status',          'require|number|in:-1,1',                  '编辑状态有误|编辑状态有误|编辑状态有误'],
        ['identity',        'require|number|in:2,3',                   '编辑状态有误|编辑状态有误|编辑状态有误'],
        ['identity_reason', 'max:64',                                  '申请理由长度不能超过64字数'],
        ['to_user',         'require|number|>:0',                      '请先选择用户|请先选择用户|请先选择用户'],
    ];

    protected $scene = [
        'create'            => ['logo', 'name', 'description', 'longitude', 'latitude', 'city'],
        'info'              => ['id'],
        'apply'             => ['id', 'reason'],
        'check'             => ['id', 'status'],
        'quit'              => ['id'],
        'applyIdentity'     => ['id', 'identity', 'identity_reason'],
        'signIn'            => ['id'],
        'invite'            => ['id', 'to_user'],
    ];
}
